package com.ruoyi.tranShort.serialPort.request;

import com.ruoyi.serialPort.api.SerialPortClientApi;
import com.ruoyi.tranShort.serialPort.api.SerialPortRequest;
import com.ruoyi.tranShort.serialPort.common.constants.ControllerNumberConstants;
import com.ruoyi.tranShort.serialPort.response.WristletPortResponse;
import com.ruoyi.tranShort.utils.SerialPortClientUtil;

/**
 * @author wwy
 * @date 2021-08-15 14:25
 */
public class WristletPortRequest implements SerialPortRequest {
    private String deviceCode;
    @Override
    public WristletPortResponse execute() {
        SerialPortClientApi serialPortClientApi = SerialPortClientUtil.getSerialPortClientApi();
        String data = ControllerNumberConstants.WRISTLET+deviceCode+"7E";
        serialPortClientApi.sendData(data);

        WristletPortResponse wristletResponse = new WristletPortResponse();
        wristletResponse.setCode(200);
        return wristletResponse;
    }

    public String getDeviceCode() {
        return deviceCode;
    }

    public void setDeviceCode(String deviceCode) {
        this.deviceCode = deviceCode;
    }
}
